<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.9.1"/>
<title>cocoOS: C:/Users/peter_000/Desktop/cocoOS/common/src/os_event.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">cocoOS
   &#160;<span id="projectnumber">5.0.3</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.9.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('os__event_8c.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#nested-classes">Data Structures</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">os_event.c File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include &quot;cocoos.h&quot;</code><br />
<code>#include &quot;stdarg.h&quot;</code><br />
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_event__t.html">Event_t</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a73d4fa65cef28ee6d4f34e3ba30d3eee"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="os__event_8c.html#a73d4fa65cef28ee6d4f34e3ba30d3eee">os_event_init</a> (void)</td></tr>
<tr class="separator:a73d4fa65cef28ee6d4f34e3ba30d3eee"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a04ba027b0848884aa6a2f5a346444be3"><td class="memItemLeft" align="right" valign="top">Evt_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="os__event_8c.html#a04ba027b0848884aa6a2f5a346444be3">event_create</a> (void)</td></tr>
<tr class="separator:a04ba027b0848884aa6a2f5a346444be3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae28468ad6bb58df9d34ebd5bd3daa548"><td class="memItemLeft" align="right" valign="top">uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="os__event_8c.html#ae28468ad6bb58df9d34ebd5bd3daa548">event_signaling_taskId_get</a> (Evt_t ev)</td></tr>
<tr class="separator:ae28468ad6bb58df9d34ebd5bd3daa548"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a72a84fa2b2c57833a600d5463c3095c1"><td class="memItemLeft" align="right" valign="top">Evt_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="os__event_8c.html#a72a84fa2b2c57833a600d5463c3095c1">event_last_signaled_get</a> (void)</td></tr>
<tr class="separator:a72a84fa2b2c57833a600d5463c3095c1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4d1de8939b3d29f31da78e2c44b3079d"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="os__event_8c.html#a4d1de8939b3d29f31da78e2c44b3079d">os_wait_event</a> (uint8_t tid, Evt_t ev, uint8_t waitSingleEvent, uint32_t timeout)</td></tr>
<tr class="separator:a4d1de8939b3d29f31da78e2c44b3079d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a17d4f782e35414af9e80c3c38d6eb76a"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="os__event_8c.html#a17d4f782e35414af9e80c3c38d6eb76a">os_signal_event</a> (Evt_t ev)</td></tr>
<tr class="separator:a17d4f782e35414af9e80c3c38d6eb76a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a80983f2fab1a01a7dd6dd4bf0c44ba8d"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="os__event_8c.html#a80983f2fab1a01a7dd6dd4bf0c44ba8d">os_event_set_signaling_tid</a> (Evt_t ev, uint8_t tid)</td></tr>
<tr class="separator:a80983f2fab1a01a7dd6dd4bf0c44ba8d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a64b465c9031c95e48d6ac44c531d224c"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="os__event_8c.html#a64b465c9031c95e48d6ac44c531d224c">os_wait_multiple</a> (uint8_t waitAll,...)</td></tr>
<tr class="separator:a64b465c9031c95e48d6ac44c531d224c"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Copyright (c) 2012 Peter Eckstrand</p>
<p>All rights reserved.</p>
<p>Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the following conditions are met:</p>
<ol type="1">
<li>Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</li>
<li>Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.</li>
</ol>
<p>NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</p>
<p>This file is part of the cocoOS operating system. Author: Peter Eckstrand <a href="#" onclick="location.href='mai'+'lto:'+'inf'+'o@'+'coc'+'oo'+'s.n'+'et'; return false;">info@<span style="display: none;">.nosp@m.</span>coco<span style="display: none;">.nosp@m.</span>os.ne<span style="display: none;">.nosp@m.</span>t</a> Event source file </p>
</div><h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="a04ba027b0848884aa6a2f5a346444be3"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Evt_t event_create </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Creates an event.</p>
<dl class="section return"><dt>Returns</dt><dd>Returns an event. </dd></dl>
<dl class="section remark"><dt>Remarks</dt><dd><b>Usage:</b> <br />
 An event is created by declaring a variable of type Evt_t and then assigning the <a class="el" href="os__event_8c.html#a04ba027b0848884aa6a2f5a346444be3">event_create()</a> return value to that variable.</dd></dl>
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;Evt_t myEvent;</div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;myEvent = event_create();</div>
</div><!-- fragment --> 
</div>
</div>
<a class="anchor" id="a72a84fa2b2c57833a600d5463c3095c1"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Evt_t event_last_signaled_get </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Gets the last signaled event</p>
<dl class="section return"><dt>Returns</dt><dd>Last signaled event</dd></dl>
<dl class="section remark"><dt>Remarks</dt><dd><b>Usage:</b> <br />
 Used when waiting for multiple events, to find out which event was signaled.</dd></dl>
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;event_wait_multiple(0, event1, event2);</div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;Evt_t lastEvt = event_last_signaled_get();</div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;if ( lastEvt == event1 ) {</div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;  ...</div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;}</div>
</div><!-- fragment --> 
</div>
</div>
<a class="anchor" id="ae28468ad6bb58df9d34ebd5bd3daa548"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint8_t event_signaling_taskId_get </td>
          <td>(</td>
          <td class="paramtype">Evt_t&#160;</td>
          <td class="paramname"><em>ev</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Gets the Task Id of the task that signaled the event.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">ev</td><td>event </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Id of task that signaled the event. </dd>
<dd>
NO_TID if a timeout occurred before the event was signaled.</dd></dl>
<dl class="section remark"><dt>Remarks</dt><dd><b>Usage:</b> <br />
 A task can make a call to this function when it has resumed execution after waiting for an event to find out which other task signaled the event.</dd></dl>
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;event_wait(event);</div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;signalingTask = event_signaling_taskId_get(event);</div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;if ( signalingTask == Task2_id ) {</div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;  ...</div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;}</div>
</div><!-- fragment --> 
</div>
</div>
<a class="anchor" id="a73d4fa65cef28ee6d4f34e3ba30d3eee"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void os_event_init </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a class="anchor" id="a80983f2fab1a01a7dd6dd4bf0c44ba8d"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void os_event_set_signaling_tid </td>
          <td>(</td>
          <td class="paramtype">Evt_t&#160;</td>
          <td class="paramname"><em>ev</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>tid</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a class="anchor" id="a17d4f782e35414af9e80c3c38d6eb76a"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void os_signal_event </td>
          <td>(</td>
          <td class="paramtype">Evt_t&#160;</td>
          <td class="paramname"><em>ev</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a class="anchor" id="a4d1de8939b3d29f31da78e2c44b3079d"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void os_wait_event </td>
          <td>(</td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>tid</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">Evt_t&#160;</td>
          <td class="paramname"><em>ev</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>waitSingleEvent</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>timeout</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a class="anchor" id="a64b465c9031c95e48d6ac44c531d224c"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void os_wait_multiple </td>
          <td>(</td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>waitAll</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>...</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_bdd9a5d540de89e9fe90efdfc6973a4f.html">common</a></li><li class="navelem"><a class="el" href="dir_4e4d22e38ca4e2e8207825ee2d00bc54.html">src</a></li><li class="navelem"><a class="el" href="os__event_8c.html">os_event.c</a></li>
    <li class="footer">Generated on Tue Aug 28 2018 17:58:05 for cocoOS by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.9.1 </li>
  </ul>
</div>
</body>
</html>
